<template>
	<view class="u-p-30">
		<view class="u-p-30 u-flex bg_FFFFFF u-b-r-16">
			<view class="">
				<u-image :src='info.avatar' shape="circle" width='100rpx' height='100rpx'></u-image>
			</view>
			<view class="u-w-600 u-m-l-20">
				<view class="u-flex u-col-top">
					<view class="u-font-30 u-weight">{{info.name}}</view>
					<view class="u-flex u-col-center u-row-center u-m-l-20 u-b-r-10"
						style="background-color:rgba(255,141,144,0.12) ;padding: 0 10rpx;">
						<u-image src="https://www.sqkjkj.vip/wxImg/my/img4.png" mode="aspectFill" width="28rpx" height='28rpx'>
						</u-image>
						<view class="u-m-l-10 u-font-28" style="color: #FF3846;">{{info.identity_name}}</view>
					</view>
				</view>
				<view class=" u-m-t-20 u-flex u-row-between u-col-top">
					<view class="">{{info.mobile}}</view>
					<view class="u-h-100">
						<view class="u-font-24 " style="color: #898989;">{{info.create_time}}注册</view>
						<view class="u-m-t-30" style="text-align: right;"
							@click="$u.route('/subcontract/invitation/massage/massage')">
							<text style="color: #FC3533;">¥{{info.deduct}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="bg_FFFFFF u-p-20 u-m-t-30 u-b-r-16" v-for="(item,index) in list" :key="index">
			<view class="" >
				<view class="u-flex u-row-between">
					<view class="u-font-30 u-weight">订单奖励</view>
					<view class="" style="text-align: right;">
						<text style="color: #FC3533;">¥{{item.amount}}</text>
					</view>
				</view>
				<view class="u-m-t-20">
					<view class="u-font-20" style="color: #898989;">{{item.create_time}}注册</view>
				</view>
			</view>
		</view>
		<!-- 加载更多 -->
		<u-loadmore :status="status" icon-type="circle" margin-top="20" margin-bottom="20" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:'',
				params:{
					id:'',
					page:1,
					page_size:20
				},
				list:[],
				status: 'loadmore',
			}
		},
		onLoad(o) {
			this.info=uni.getStorageSync('invitaInfo')
			this.params.id=o.id
			this.clear()
			this.reward_detail_list()
		},
		// 下拉到底事件
		onReachBottom() {
			//避免多次触发
			if (this.status == 'loading' || this.status == 'nomore') {
				return;
			}
			this.reward_detail_list();
		},
		methods: {
			clear() {
				this.list = [];
				this.params.page = 1;
			},
			reward_detail_list() {
				this.$api.reward_detail_list(this.params, res => {
					if (res.data.code == 1) {
						if (res.data.data.data.length < 20) {
							this.status = 'nomore';
						} else {
							this.params.page = this.params.page + 1;
							this.status = 'loadmore';
						}
						this.list = this.list.concat(res.data.data.data);
						uni.stopPullDownRefresh();
					}
				})
			},
		}
	}
</script>

<style scoped>
	page {
		background: #f5f5f5;
	}
</style>
